<?php
/**
 * Created by PhpStorm.
 * User: Su
 * Date: 2014/10/16
 * Time: 17:35
 */

// 2014-10-16 by sutroon
function get_ui_table_list_head($url, $enableSearch = false)
{
    global $tab, $ln;
    $str='';
    if ($enableSearch) {
        echo  '<div class="search-panel">' . $ln;
        echo  $tab . '<form method="post" action="{:U(\'' . $url . '\')}">' . $ln;
        echo  $tab . $tab . '名称：<input type="text" name="name" value="{$search.name}"/>' . $ln;
        echo  $tab . $tab . '日期：<input type="text" name="date" class="datepicker" value="{$search.date}"/>' . $ln;
        echo  $tab . $tab . '状态：<select name="state" title="请选择状态"><option value="">所有</option><option value="1">正常</option><option value="0">关闭</option></select>' . $ln;
        echo  $tab . $tab . '<button type="button" class="btn-search lnk-submit">搜索</button>' . $ln;
        echo  $tab . $tab . '<button type="button" class="btn-export lnk-submit">导出</button>' . $ln;
        echo  $tab . $tab . '<button type="button" class="btn-refresh lnk-refresh">刷新</button>' . $ln;
        echo  $tab . $tab . '<input type="hidden" name="action" value="display"/>' . $ln;
        echo  $tab . $tab . '<input type="hidden" name="show" value="{$show}" />' . $ln;
        echo  $tab . '</form>' . $ln;
        echo  '</div>' . $ln;
    }else{
        $str.='<a href="{:U(\''.$url.'\',\'show=dialog\')}" class="btn-icon btn-plus btn-small lnk-add">新增</a>';
        $str.='<a href="#" class="btn-refresh btn-icon btn-small lnk-refresh">刷新</a>';
    }
    echo  '<div id="main-content">' . $ln;
    echo  $tab . '<table class="table-list">';
}

// 2014-10-16 by sutroon
function get_ui_table_list_foot($enableSearch = false)
{
    global $tab, $ln;
    echo  $tab . '</table>' . $ln;
    echo  $tab . '{$page}' . $ln;
    echo  '</div>' . $ln;
    if ($enableSearch) {
        echo  '<script>' . $ln;
        echo  '$(\'.search-panel .lnk-submit\').click(function () {' . $ln;
        echo  $tab . '$frm = $(\'.search-panel form\');' . $ln;
        echo  $tab . '$frm.find(\'input[name="action"]\').val($(this).text() == \'导出\' ? \'export\' : \'display\');' . $ln;
        echo  $tab . '$frm.submit();' . $ln;
        echo  $tab . '})' . $ln;
        echo  '</script>';
    }
}

// 2014-10-16 by sutroon
function get_ui_form_head($url)
{
    global $tab, $ln;
    echo  '<div class="panel label5-form">' . $ln;
    echo  $tab . '<form action="{:U(\'' . $url . '\')}" method="post">' . $ln;
    echo  $tab . $tab . '<ul>';
}
// 2014-10-16 by sutroon
function get_ui_form_field(){
    global $tab,$ln;
    $str=$ln.$tab.$tab.$tab.'<li>'.$ln;
    $str.=$tab.$tab.$tab.'<label>{comment}：</label>'.$ln;
    $str.=$tab.$tab.$tab.'{control}'.$ln;
    $str.='</li>'.$ln;
}

// 2014-10-16 by sutroon
function get_ui_form_foot()
{
    global $tab, $ln;
    echo  $tab . $tab . $tab . '<li>' . $ln;
    echo  $tab . $tab . $tab . $tab . '<label>&nbsp;</label>' . $ln;
    echo  $tab . $tab . $tab . $tab . '<input type="submit" value="保存" />' . $ln;
    echo  $tab . $tab . $tab . '</li>' . $ln;
    echo  $tab . $tab . '</ul>' . $ln;
    echo  $tab . $tab . '<input type="hidden" name="id" value="{$data.id}" />' . $ln;
    echo  $tab . $tab . '<input type="hidden" name="show" value="{$show}" />' . $ln;
    echo  $tab . '</form>' . $ln;
    echo  '</div>';
}